<?php
	

defined('_JEXEC') or die();

jimport( 'joomla.application.component.view' );

class NBEventMapsViewNBEventMap extends JView
{
	
	
	function display($tpl = null)
	{
		
		$mainframe = &JFactory::getApplication(); 
		$option    = JRequest::getCMD('option'); 

        $lang 		= JFactory::getLanguage(); 
        $tag_lang	= $lang->getTag();
		if (($tag_lang!='en-AU') AND ($tag_lang!='en-GB') AND ($tag_lang!='pt-BR') AND ($tag_lang!='pt-PT') AND ($tag_lang!='zh-CN') AND ($tag_lang!='zh-TW'))
			{$tag_lang=(substr($lang->getTag(),0,2)); };

		$this->document->setMetaData('viewport', 'initial-scale=1.0, user-scalable=no');
        $this->document->addCustomTag( '<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true&language='.$tag_lang.'"></script>'); 

		$nbeventmap		=& $this->get('Data');
		$marqueurs	=& $this->get('Marqueurs');
		$isNew		= ($nbeventmap->id < 1);
		
 
		
		
		$config =& JComponentHelper::getParams('com_nbeventmap');

			$text = $isNew ? JText::_( 'JTOOLBAR_NEW' ) : JText::_( 'JTOOLBAR_EDIT' );
		JToolBarHelper::title(   JText::_( 'NBEVENTMAP_LIEUX_MANAGER' ).': <small>[ ' . $text.' ]</small>', 'frontpage.png' );
		JToolBarHelper::apply();
		JToolBarHelper::save();
		if ($isNew)  {
			JToolBarHelper::cancel();
		} else {
			
			JToolBarHelper::cancel( 'cancel', 'JTOOLBAR_CLOSE' );
		}
		JHTML::_('behavior.tooltip');
		JHTML::_('behavior.calendar');
		

		
		$query = 'SELECT ordering AS value, nom AS text'
			. ' FROM #__nbeventmap'
			
			. ' ORDER BY ordering';

		$lists['ordering'] 			= JHTML::_('list.specificordering',  $nbeventmap, $nbeventmap->id, $query );

		$categories = JHtml::_('category.options', $option);
		array_unshift($categories, JHTML::_('select.option',  '', JText::_('JOPTION_SELECT_CATEGORY')));
		$lists['catid'] = JHTML::_(
			'select.genericlist',
			$categories,
			'catid',
			'class="inputbox required" size="1" ',
			'value', 'text',
			intval( $nbeventmap->catid )
		);
		
		$files = $this->get('Files');
		
		$this->assignRef('nbeventmap',		$nbeventmap);
		$this->assignRef('marqueurs',	$marqueurs);
		$this->assignRef('config',	$config);
		$this->assignRef('lists',		$lists);
		$this->assignRef('files',		$files);

		parent::display($tpl);
	}
}
